//
//  HZHomeCell.m
//  微博 OC
//
//  Created by 黑眼圈 on 16/4/21.
//  Copyright © 2016年 heiyan. All rights reserved.
//

#import "HZHomeCell.h"
#import "HZHomeCellVM.h"


//define this constant if you want to use Masonry without the 'mas_' prefix
#define MAS_SHORTHAND
//define this constant if you want to enable auto-boxing for default syntax
#define MAS_SHORTHAND_GLOBALS



#import <Masonry/Masonry.h>
#import "HZOwnView.h"

@interface HZHomeCell()

@property(nonatomic,strong)HZOwnView*  ownView;

@end

@implementation HZHomeCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        [self setupUI];
    }
    return self;
}

-(void)setCellVM:(HZHomeCellVM *)cellVM{
    _cellVM = cellVM;
    
    //一有数据就给原创微博视图赋值
    self.ownView.cellVM = cellVM;
    
    
}



//添加子控件
-(void)setupUI{
    
    self.ownView = [[HZOwnView alloc]init];
    
    [self.contentView addSubview:self.ownView];
    
    
    //约束
    [self.ownView makeConstraints:^(MASConstraintMaker *make) {
        
        make.leading.trailing.top.equalTo(0);
//        make.height.equalTo(80);
    }];
    
    
    //预估高度
    [self.contentView makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(self.ownView);
    }];
    
}

#pragma mark -
#pragma mark     懒加载子控件
-(void)setOwnView:(HZOwnView *)ownView{
    _ownView = ownView;
    
    _ownView.backgroundColor = [UIColor colorWithWhite:237/255.0 alpha:1];
    
}















@end
